<!-- 底部导航栏 -->
<template>
  <van-tabbar v-model="active" active-color="#17aa48" :route="true" >
    <van-tabbar-item icon="wap-home-o" to="/home">首页</van-tabbar-item>
    <van-tabbar-item icon="apps-o" :to="{ path: '/menu', query: { id: 1 }}">菜单</van-tabbar-item>
    <van-tabbar-item icon="cart-o" to="/cart" :badge="props.cart_badge">购物车</van-tabbar-item>
    <van-tabbar-item icon="contact" to="/user">我的</van-tabbar-item>
  </van-tabbar>
</template>

<script setup>
import { onMounted, ref } from 'vue'

const props = defineProps({
  cart_badge: {
    type: Number
  }
})

// 设置默认索引为0，即选中首页
const active = ref(1)
onMounted(() => {
  // console.log(active.value);
})
</script>

<style lang="less" scoped>

</style>